#BEGIN
#name=subsonic
#nead=openjdk
#END

## Installation serveur de streaming audio
#if [[ `which subsonic` == "" ]] ; then
#	apt-get install openjdk-6-jre -y || exit -1
#fi

#rm -f /var/lib/mpd/music/musique
#ln -s /mnt/raid/to_snap/MUSIQUE /var/lib/mpd/music/musique || exit -1


apt-get install lame flac faad vorbis-tools ffmpeg -y

wget -c http://downloads.sourceforge.net/project/subsonic/subsonic/4.4/subsonic-4.4.deb?r=http%3A%2F%2Fwww.subsonic.org%2Fpages%2Fdownload2.jsp%3Ftarget%3Dsubsonic-4.4.deb&ts=1308573914&use_mirror=leaseweb || exit -1


dpkg -i subsonic-4.4.deb?r=http:%2F%2Fwww.subsonic.org%2Fpages%2Fdownload2.jsp?target=subsonic-4.4.deb || exit -1


sed -i "s/^\(SUBSONIC_ARGS\).*=.*\"\(.*\)\"/\1=\"--max-memory=100 --port=2000 --https-port=2001\"/" /etc/default/subsonic || exit -1

/etc/init.d/subsonic restart
